/**
 * 新增提交
 */
function submitForm_add() {
	$("#userPass").val(hex_md5($("#userPass1").val()));
    var data = $("#submit_form_add").serializeJson();

//
//    var files = new Array();
//    $('input[type="file"]').each(function() {
//        files.push($(this).attr("name"));
//    });
//


    ajaxSubmitFileForm("/forum/user/register", data);

}

function ajaxSubmitFileForm(reqUrl, sendData,files){
    $.ajaxFileUpload({
        url: ctx + reqUrl,
        secureuri: false,
        async: false,
        fileElementId: files,
        dataType: 'json',
        data: sendData,
        success: function (res) {
        }
    });
}
$(function() {
    $.fn.serializeJson = function () {
        var serializeObj = {};
        var array = this.serializeArray();
        var str = this.serialize();
        $(array).each(function () {
            if (serializeObj[this.name]) {
                if ($.isArray(serializeObj[this.name])) {
                    serializeObj[this.name].push(this.value);
                } else {
                    serializeObj[this.name] = [serializeObj[this.name], this.value];
                }
            } else {
                serializeObj[this.name] = this.value;
            }
        });
        return serializeObj;
    };
});